package com.globallogic.capacitaciones.hibernate.domain;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="custom_item")
public class Item extends PersistentObject{
	
	private String name;
	private String description;
	private BigDecimal initialPrice;
	private BigDecimal reservePrice;
	private Date startDate;
	private Date endDate;
	private Date approvalDatetime;
	@ManyToMany(mappedBy="items")
	private List<Category> categories;
	@ManyToOne
	private User buyer;
	@OneToOne
	private Bid successful;
	@OneToMany
	private List<Bid> bids;
	@ManyToOne
	private User soldby;
	
	
	public Item() {
		super();
	}
	
	public Item(String name, String description, BigDecimal initialPrice,
			BigDecimal reservePrice, Date startDate, Date endDate,
			Date approvalDatetime) {
		super();
		this.name = name;
		this.description = description;
		this.initialPrice = initialPrice;
		this.reservePrice = reservePrice;
		this.startDate = startDate;
		this.endDate = endDate;
		this.approvalDatetime = approvalDatetime;
	}


	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public BigDecimal getInitialPrice() {
		return initialPrice;
	}
	public void setInitialPrice(BigDecimal initialPrice) {
		this.initialPrice = initialPrice;
	}
	public BigDecimal getReservePrice() {
		return reservePrice;
	}
	public void setReservePrice(BigDecimal reservePrice) {
		this.reservePrice = reservePrice;
	}
	public Date getStartDate() {
		return startDate;
	}
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	public Date getApprovalDatetime() {
		return approvalDatetime;
	}
	public void setApprovalDatetime(Date approvalDatetime) {
		this.approvalDatetime = approvalDatetime;
	}


	public User getBuyer() {
		return buyer;
	}

	public void setBuyer(User buyer) {
		this.buyer = buyer;
	}

	public List<Category> getCategories() {
		return categories;
	}

	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}

	public Bid getSuccessful() {
		return successful;
	}

	public void setSuccessful(Bid successful) {
		this.successful = successful;
	}

	public List<Bid> getBids() {
		return bids;
	}

	public void setBids(List<Bid> bids) {
		this.bids = bids;
	}

	public User getSoldby() {
		return soldby;
	}

	public void setSoldby(User soldby) {
		this.soldby = soldby;
	}
	
}